import { ElMessage, ElMessageBox } from 'element-plus'
import { getConfig } from "/@/config";

export function useSuccessMessage(message: string = '操作成功') {
  ElMessage.success(message)
}

export function useWarningMessage(message: string) {
  ElMessage.warning(message)
}

export function useErrorMessage(message: string = '操作失败') {
  ElMessage.error(message)
}

export function useInsertSucessMessage() {
  useSuccessMessage('新增成功！')
}

export function useUpdateSucessMessage() {
  useSuccessMessage('修改成功！')
}

export function useDeleteSucessMessage() {
  useSuccessMessage('删除成功！')
}

export function useTableNotCheck() {
  ElMessage.warning('请至少选中一条记录！')
}

export function useConfirm(type: 'success' | 'info' | 'warning' | 'error', message: string) {
  return ElMessageBox.confirm(message, getConfig().Title, {
    type: type || 'success',
    showCancelButton: false
  })
} 
